From: Carlhuda Date: Fri, 2 May 2014 01:14:24 +0000 (-0700) Subject: cargo-compile delegates to cargo-rustc X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~1094 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=71066787bf25a3b1582033ea55885a511da6996b;p=cargo.git cargo-compile delegates to cargo-rustc --- diff --git a/libs/hamcrest-rust b/libs/hamcrest-rust index de700414a..add50d98e 160000 --- a/libs/hamcrest-rust +++ b/libs/hamcrest-rust @@ -1 +1 @@ -Subproject commit de700414aab1aaa4461618ce7a516cb24a8e6665 +Subproject commit add50d98e97ef30e7264ae70b83cf5ddedbf4450 diff --git a/src/cargo/core/resolver.rs b/src/cargo/core/resolver.rs index c52c11af1..1f5386716 100644 --- a/src/cargo/core/resolver.rs +++ b/src/cargo/core/resolver.rs @@ -19,7 +19,7 @@ pub fn resolve(deps: &[core::Dependency], registry: &core::Registry) -> CargoRes let opts = registry.query(curr.get_name()); - assert!(!resolve.contains_key_equiv(&curr.get_name()), "already traversed {}", curr.get_name()); + //assert!(!resolve.contains_key_equiv(&curr.get_name()), "already traversed {}", curr.get_name()); // Temporary, but we must have exactly one option to satisfy the dep assert!(opts.len() == 1, "invalid num of results {}", opts.len()); diff --git a/src/cargo/mod.rs b/src/cargo/mod.rs index a4e8bfcc0..3dc7e22be 100644 --- a/src/cargo/mod.rs +++ b/src/cargo/mod.rs @@ -93,8 +93,8 @@ impl ToCargoError> for Option { trait RepresentsFlags : FlagConfig + Decodable {} impl> RepresentsFlags for T {} -trait RepresentsJSON : Decodable {} -impl > RepresentsJSON for T {} +trait RepresentsJSON : Decodable {} +impl > RepresentsJSON for T {} #[deriving(Decodable)] pub struct NoFlags; @@ -151,5 +151,5 @@ fn json_from_stdin() -> CargoResult { let json = try!(json::from_str(input).to_cargo_error(format!("Cannot parse json: {}", input), 1)); let mut decoder = json::Decoder::new(json); - Decodable::decode(&mut decoder).to_cargo_error(|e: json::Error| format!("{}", e), 1) + Decodable::decode(&mut decoder).to_cargo_error(|e: json::DecoderError| format!("{}", e), 1) } diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 0ad7eeeeb..925800d1a 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -31,6 +31,7 @@ use core::Package; use core::source::Source; use core::dependency::Dependency; use sources::path::PathSource; +use ops::cargo_rustc; use {CargoError,ToCargoError,CargoResult}; #[deriving(Decodable)] @@ -65,7 +66,9 @@ pub fn compile() -> CargoResult<()> { let packages = try!(source.get(names.as_slice())); let registry = PackageSet::new(packages.as_slice()); - let resolved = resolve(deps.as_slice(), ®istry); + let resolved = try!(resolve(deps.as_slice(), ®istry)); + + cargo_rustc::compile(&resolved); Ok(()) //call_rustc(~BufReader::new(manifest_bytes.as_slice())) diff --git a/src/cargo/ops/cargo_rustc.rs b/src/cargo/ops/cargo_rustc.rs index 3cea643e0..39c410efa 100644 --- a/src/cargo/ops/cargo_rustc.rs +++ b/src/cargo/ops/cargo_rustc.rs @@ -12,7 +12,7 @@ type Args = Vec<~str>; pub fn compile(pkgs: &core::PackageSet) { let sorted = match pkgs.sort() { Some(pkgs) => pkgs, - None => return + None => fail!("Could not perform topsort on PackageSet") }; for pkg in sorted.iter() { @@ -23,7 +23,7 @@ pub fn compile(pkgs: &core::PackageSet) { fn compile_pkg(pkg: &core::Package, pkgs: &core::PackageSet) { // Build up the destination - let src = pkg.get_root().join(Path::new(pkg.get_source().name.as_slice())); + let src = pkg.get_root().join(Path::new(pkg.get_source().path.as_slice())); let target = pkg.get_root().join(Path::new(pkg.get_target())); // First ensure that the directory exists diff --git a/src/cargo/util/process_builder.rs b/src/cargo/util/process_builder.rs index 8d8958bfc..c1c1348a3 100644 --- a/src/cargo/util/process_builder.rs +++ b/src/cargo/util/process_builder.rs @@ -1,7 +1,7 @@ use std::os; use std::path::Path; use std::io; -use std::io::process::{Process,ProcessConfig,ProcessOutput}; +use std::io::process::{Process,ProcessConfig,ProcessOutput,InheritFd}; use ToCargoError; use CargoResult; @@ -33,12 +33,15 @@ impl ProcessBuilder { self } + // TODO: clean all this up pub fn exec(&self) -> io::IoResult<()> { let mut config = ProcessConfig::new(); config.program = self.program.as_slice(); config.args = self.args.as_slice(); config.cwd = Some(&self.cwd); + config.stdout = InheritFd(1); + config.stderr = InheritFd(2); let mut process = try!(Process::configure(config)); let exit = process.wait();